#pragma once
#include <glad/gl.h>
#include <glm/glm.hpp>
#include <filesystem>
#include "Core.h"

namespace lazy {

    class Shader {
    public:
        Shader();
        ~Shader();
        void Bind();
        void Unbind();

    public:
        static Ref<Shader> LoadFromFile(const std::filesystem::path& vertFilePath, const std::filesystem::path& fragFilePath);

    public:
        void SetBool(const std::string &name, bool value);
        void SetInt(const std::string &name, int value);
        void SetIntArray(const std::string &name, int *values, uint32_t count);
        void SetFloat(const std::string &name, float value);
        void SetFloat2(const std::string &name, const glm::vec2 &vec);
        void SetFloat3(const std::string &name, const glm::vec3 &vec);
        void SetFloat4(const std::string &name, const glm::vec4 &vec);
        void SetMat2(const std::string &name, const glm::mat2 &mat);
        void SetMat3(const std::string &name, const glm::mat3 &mat);
        void SetMat4(const std::string &name, const glm::mat4 &mat);

    private:
        std::string ReadFile(const std::filesystem::path& filePath);
        void InitProgram(const std::filesystem::path& vertFilePath, const std::filesystem::path& fragFilePath);
        void CheckCompileErrors(GLuint shader, const std::string& type);

    private:
        GLuint m_ProgramID;
    };

} // lazy
